package br.com.skytef.servlet.POS;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import br.com.skytef.beans.POS.Logica;
import br.com.skytef.beans.POS.SystemSession;
import br.com.skytef.entity.MessageEntity;

public class ServletItemExc implements Logica {

	@Override
	public String executa(HttpServletRequest request, HttpServletResponse response, HttpSession session) throws Exception {
		SystemSession sysSessionRecover = null;
		SystemSession sysSessionNew = null;
		MessageEntity msg = new MessageEntity();

		try {
			sysSessionRecover = (SystemSession) session.getAttribute("SysSession");
			sysSessionNew = sysSessionRecover;

			msg.setTitle("Servlet Processada");
			msg.setBody("Add exc");

			sysSessionNew.setMessage(msg);
			sysSessionNew.setNextServlet("x_ServletMenuProduct");
			sysSessionNew.setDisplayTitle(sysSessionRecover.getDisplayTitle());
			sysSessionNew.setNextView("/jsp/POS/ModMensagem.jsp");
		} catch (Exception e) {
			System.out.println("##> Erro ao processar a servlet: " + sysSessionNew.getNextServlet() + "\n" + e.getMessage());
		}

		return sysSessionNew.getNextView();
	}
	
}
